package com.skyolder.milkbee.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.query.criteria.internal.predicate.NegatedPredicateWrapper;

import com.skyolder.milkbee.constant.FactorConstant;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * A Factor.
 */
@Entity
@Table(name = "factor")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Factor implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "name")
    private String name;

    @Column(name = "param")
    private Long param;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public Factor name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getParam() {
        return param;
    }

    public Factor param(Long param) {
        this.param = param;
        return this;
    }

    public void setParam(Long param) {
        this.param = param;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Factor factor = (Factor) o;
        if (factor.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, factor.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "Factor{" +
            "id=" + id +
            ", name='" + name + "'" +
            ", param='" + param + "'" +
            '}';
    }

	public static List<Factor> initAll() {
		// TODO Auto-generated method stub
		List<Factor> list=new ArrayList<Factor>();
		{
			Factor f=new Factor();
			f.setName(FactorConstant.POST_CARD_SCORE);
			f.setParam(2L);
			list.add(f);
		}
		{
			Factor f=new Factor();
			f.setName(FactorConstant.POST_COMMENT_SCORE);
			f.setParam(1L);
			list.add(f);
		}
		{
			Factor f=new Factor();
			f.setName(FactorConstant.CARD_BE_ESSENCE);
			f.setParam(10L);
			list.add(f);
		}
		{
			Factor f=new Factor();
			f.setName(FactorConstant.CARD_BE_LIGHT);
			f.setParam(1L);
			list.add(f);
		}
		{
			Factor f=new Factor();
			f.setName(FactorConstant.COMMENT_BE_LIGHT);
			f.setParam(1L);
			list.add(f);
		}
		{
			Factor f=new Factor();
			f.setName(FactorConstant.CARD_BE_ACCUSATION);
			f.setParam(-10L);
			list.add(f);
		}
		{
			Factor f=new Factor();
			f.setName(FactorConstant.COMMENT_BE_ACCUSATION);
			f.setParam(-8L);
			list.add(f);
		}
		{
			Factor f=new Factor();
			f.setName(FactorConstant.FIRE_LEVEL);
			f.setParam(500L);
			list.add(f);
		}
		return list;
	}
}
